/**
 * Created by CK on 2016/10/12.
 */
$(document).ready(function(){
    $.fn.pagination.defaults.displayMsg = '';
    var schoolId = xhTool.getQuery('iSchoolId');
    var teacherList = $('#TeacherList');
    var appCodeDom = $('#sl_AppCode');
    var queryParams = {iSchoolId: schoolId, iUserType: 4};
    var appCode;
    var teacherId;
    appCodeDom.select2();
    $('.xh-datagrid-toolbar').parseToolbar(afterParseToolbar);
    teacherList.initDataGrid(baseUrl + 'User/getDgData', {"queryParams": queryParams})
        .setSelectThenEnable([], ['bt_ViewClass'], 'bs');
    $('#bt_ViewClass').click(function(){
        appCode = appCodeDom.val();
        teacherId = teacherList.getDataGridSelectedField('iUserId');
        if(!appCode || !teacherId) return false;
        $('#iframe_ViewClass').attr('src',
            baseUrl + 'Class/openClass?navUl=false&iTeacherId=' + teacherId + '&iAppCode=' + appCode + '&iSchoolId=' + schoolId
        );
    });
    function afterParseToolbar()
    {
        $.overtFun.vagueSearch(teacherList, queryParams, $('#TeacherList_Search'));
    }
});
